import request from '@/utils/request'
const PATH = '/admin/courseCategory'
// 获取课程分类列表
export const getCourseCategoryList = ({
  page,
  pageSize,
  courseCategoryName,
  status
}) => {
  return request.get(PATH + '/page', {
    params: {
      page,
      pageSize,
      courseCategoryName,
      status
    }
  })
}

// 新增课程分类
export const insertCourseCategory = (data) => {
  return request.post(PATH + '/insert', data)
}

// 批量删除
export const batchDeleteCourseCategory = (ids) => {
  return request.delete(PATH + '/batchDelete', {
    params: {
      ids: ids.join(',')
    }
  })
}

// 修改课程分类状态
export const updateCourseCategoryStatus = ({ id, status }) => {
  return request.post(PATH + `/status/${status}`, {
    id
  })
}

// 根据id查询课程分类
export const getCourseCategoryById = (id) => {
  return request.get(PATH + '/getByCourseCategoryId', {
    params: {
      id
    }
  })
}

// 修改课程分类信息
export const updateCourseCategory = (data) => {
  return request.put(PATH + '/update', data)
}

// 查询所有启动的课程分类
export const getAllCourseCategory = () => {
  return request.get(PATH + '/getAll')
}
